//
//  ImageManger.m
//  学生汇
//
//  Created by yull on 14/12/5.
//  Copyright (c) 2014年 于博. All rights reserved.
//

#import "ImageManger.h"

@implementation ImageManger

+ (BOOL)SDWebImageExist:(NSString *)imgUrl
{
    return [[SDWebImageManager sharedManager] cachedImageExistsForURL:[NSURL URLWithString:imgUrl]];
}

+ (UIImage *)SDWebImageForUrl:(NSString *)imgUrl
{
    SDWebImageManager *manager = [SDWebImageManager sharedManager];
    if (![manager cachedImageExistsForURL:[NSURL URLWithString:imgUrl]]) {
        return nil;
    }
    
    NSString *key = [manager cacheKeyForURL:[NSURL URLWithString:imgUrl]];
    
    UIImage *image = [manager.imageCache imageFromMemoryCacheForKey:key];
    if (!image) {
        image = [manager.imageCache imageFromDiskCacheForKey:key];
    }
    return image;
}
@end
